package com.jhopesoft.business.sales.entity;
// default package
// Generated 2018-3-6 16:54:10 by Hibernate Tools 5.2.6.Final

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * SlProduct generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "sl_product", uniqueConstraints = @UniqueConstraint(columnNames = "name_"))
public class SlProduct implements java.io.Serializable {

	private String id;
	private SlProducttype slProducttype;
	private SlProvince slProvince;
	private String name;
	private String unitText;
	private BigDecimal unitPrice;
	private BigDecimal costPrice;
	private Set<SlOrderdetail> slOrderdetails = new HashSet<SlOrderdetail>(0);

	public SlProduct() {
	}

	public SlProduct(String id, SlProducttype slProducttype, SlProvince slProvince, String name) {
		this.id = id;
		this.slProducttype = slProducttype;
		this.slProvince = slProvince;
		this.name = name;
	}

	public SlProduct(String id, SlProducttype slProducttype, SlProvince slProvince, String name, String unitText,
			BigDecimal unitPrice, BigDecimal costPrice, Set<SlOrderdetail> slOrderdetails) {
		this.id = id;
		this.slProducttype = slProducttype;
		this.slProvince = slProvince;
		this.name = name;
		this.unitText = unitText;
		this.unitPrice = unitPrice;
		this.costPrice = costPrice;
		this.slOrderdetails = slOrderdetails;
	}

	@Id

	@Column(name = "id_", unique = true, nullable = false, length = 10)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "typeid_", nullable = false)
	public SlProducttype getSlProducttype() {
		return this.slProducttype;
	}

	public void setSlProducttype(SlProducttype slProducttype) {
		this.slProducttype = slProducttype;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "provinceid_", nullable = false)
	public SlProvince getSlProvince() {
		return this.slProvince;
	}

	public void setSlProvince(SlProvince slProvince) {
		this.slProvince = slProvince;
	}

	@Column(name = "name_", unique = true, nullable = false, length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "unit_text_", length = 20)
	public String getUnitText() {
		return this.unitText;
	}

	public void setUnitText(String unitText) {
		this.unitText = unitText;
	}

	@Column(name = "unit_price_", precision = 10)
	public BigDecimal getUnitPrice() {
		return this.unitPrice;
	}

	public void setUnitPrice(BigDecimal unitPrice) {
		this.unitPrice = unitPrice;
	}

	@Column(name = "cost_price_", precision = 10)
	public BigDecimal getCostPrice() {
		return this.costPrice;
	}

	public void setCostPrice(BigDecimal costPrice) {
		this.costPrice = costPrice;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "slProduct")
	public Set<SlOrderdetail> getSlOrderdetails() {
		return this.slOrderdetails;
	}

	public void setSlOrderdetails(Set<SlOrderdetail> slOrderdetails) {
		this.slOrderdetails = slOrderdetails;
	}

}
